package com.javaweb.config.datasource.common;

import org.springframework.stereotype.Component;

import com.javaweb.constant.SystemConstant;
import com.javaweb.db.help.IdAutoCreate;

/**
 * ID自动生成策略
 * @see com.javaweb.db.mybatis.api.adapter.SqlForMySql#getIdAutoCreate
 * @author tank2140896
 */
@Component
public class IdGenerator implements IdAutoCreate<String> {

	/**
	 * ID生成（与数据库主键类型相关，如果数据库主键类型是数字类型，则SystemConstant.SYSTEM_NO也必须是数字）
	 */
	public String idCreate() {
		return String.valueOf(withSnowflakeId()) + SystemConstant.SYSTEM_NO;
		//return SecretUtil.defaultGenUniqueStr(SystemConstant.SYSTEM_NO);
	}

}
